package com.study.webapp.leetcode;

import com.alibaba.fastjson.JSON;

/**
 * 删除有序列表的重复数据
 */
public class Leet_83 {

	public static void main(String[] args) {
		ListNode node = new ListNode(1);
		ListNode node1 = new ListNode(1);
		ListNode node2 = new ListNode(2);
		ListNode node3 = new ListNode(3);
		ListNode node4 = new ListNode(3);
		node3.next = node4;
		node2.next = node3;
		node1.next = node2;
		node.next = node1;
		System.out.println(deleteDuplicates(node));
	}



	public static ListNode deleteDuplicates(ListNode head) {
		if (head == null) {
			return head;
		}
		ListNode node = head;
		while (node.next != null) {
			if (node.val == node.next.val) {
				node.next = node.next.next;
			} else {
				node = node.next;
			}
		}
		return head;
	}





}
